package com.example.kafka.controller;

import com.example.kafka.service.ConsumerLeakService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用例6 Controller
 */
@RestController
public class ConsumerLeakController {
    @Autowired
    private ConsumerLeakService consumerLeakService;

    @GetMapping("/query1")
    public String query(@RequestParam String key) {
        return consumerLeakService.query(key);
    }

    @PostMapping("/startThread2")
    public String startThread() {
        consumerLeakService.startThread();
        return "ok";
    }

    @PostMapping("/consume3")
    public String consume() {
        consumerLeakService.consume();
        return "ok";
    }

    @PostMapping("/changePartition4")
    public String changePartition(@RequestParam int partition) {
        consumerLeakService.changePartition(partition);
        return "ok";
    }

    @PostMapping("/monitor5")
    public String monitor() {
        consumerLeakService.monitor();
        return "ok";
    }
}
